<ul class="submenu">
	<li><?php echo anchor($this->curl . '/create', T_('New parameter'), 'class="arrow-right"')?></li>
	<li><a href="javascript:void(0)" onclick="if (confirm('<?php echo T_('Are you sure you want to delete these data?'); ?>')) deleteItems('/admin/<?php echo $this->curl; ?>/deleteItems/');return false;"><?php echo T_('Delete Selected'); ?></a></li>
</ul>

<?php echo form_open($this->curl . '/'. $this->uri->segment(2) .'/')?>
<?php echo form_hidden('func', $this->uri->segment(2))?>
  
<table width="100%" border="0" cellpadding="3" cellspacing="0" id="grid" class="display">
<thead>
<tr>
    <th class="first" width="27"><?php echo form_checkbox('cid_toggle', null, FALSE, 'id="cid_toggle" onclick="toggleCheckboxes($(this))"')?></th>
    <th><?php echo $this->settings_model->fields['name']; ?></th>
    <th><?php echo $this->settings_model->fields['value']; ?></th>
    <th><?php echo $this->settings_model->fields['uom']; ?></th>
    <th><?php echo $this->settings_model->fields['description']; ?></th>
    <th><?php echo T_('Edit'); ?></th>
</tr>
</thead>
<tbody>
<?php if(!empty($list)):?>
<?php 
	foreach ($list as $row) {
?>			
<tr id="tr_<?php echo $row->name?>">
	<td class="t-center"><?php echo form_checkbox('cid[]', $row->name, FALSE, 'class="checkbox" id="cb'. $row->name.'"')?></td>	
	<td><?php echo $row->name?></td>
	<td><?php echo $row->value?></td>
	<td><?php echo $row->uom?></td>
	<td><?php echo $row->description?></td>
	<td width="26" class="t-center"><?php echo anchor($this->curl.'/edit/'.$row->name, ' ', 'class="btn_edit" alt="'.T_('Edit').'" title="'.T_('Edit').'"')?></td>
</tr>
<?php } ?>
<?php endif;?>
</tbody>
</table>
	
<?php echo form_close()?>

<script type="text/javascript" charset="utf-8">
var oTable;

$(document).ready(function() {

	  /* Add a click handler to the rows - this could be used as a callback */
	  $('#grid tr').click( function() {
	    if ( $(this).hasClass('row_selected') )
	    {     
	      $(this).removeClass('row_selected');
	      $(this).find('.checkbox').removeAttr('checked');
	    }     
	    else
	    {
	      $(this).addClass('row_selected');
	      $(this).find('.checkbox').attr('checked', 'checked');
	    }     
	  });
	  	
	/* Init DataTables */
	oTable = $('#grid').dataTable(
	{
		"aaSorting": [],				
		"aoColumns": [
  			{ "bSortable": false },
  			null,
  			{ "bSortable": false },
  			{ "bSortable": false },
  			{ "bSortable": false },
  			{ "bSortable": false }
  		],

		"bPaginate": true,
		"bLengthChange": true,
		"bFilter": true,	
		"bSort": true,
		"bInfo": true,
		"bAutoWidth": true,
		"bJQueryUI": true,
		"sPaginationType": "full_numbers"
	});	
});

/*
 * I don't actually use this here, but it is provided as it might be useful and demonstrates
 * getting the TR nodes from DataTables
 */
function fnGetSelected( oTableLocal )
{
  var aReturn = new Array();
  var aTrs = oTableLocal.fnGetNodes();
  
  for ( var i=0 ; i<aTrs.length ; i++ )
  {
    if ( $(aTrs[i]).hasClass('row_selected') )
    {
      aReturn.push( aTrs[i] );
    }
  }
  return aReturn;
}
</script>